﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using GD.ModelContest.Common;
using GD.ModelContest.Model;
using GD.ModelContest.Service;

namespace GD.ModelContest.Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = this.txtUserName.Text.Trim();
            string password = this.txtPassword.Text.Trim();
            mc_user mcUser = ServiceLocator.IUserService.GetUserLogin(userName, password);
            if (mcUser != null)
            {
                Session["User"] = mcUser.userId;
                JavaScript.ShowJS("登录成功", "UserView.aspx?UserId=" + mcUser.userId, this.Page);
            }
            else
            {
                JavaScript.Alert("登录失败", this.Page);
            }
        }
    }
}
